<?php

namespace App\Services\Bankcard;

use App\Services\Bankcard\Bankcard\BankcardLogic;

/**
 * 银行卡服务层
 * Class ApiBankcard
 * @package App\Services\Bankcard
 */
class ApiBankcard
{
    /*后台 - 获取银行卡列表（分页数据）*/
    public function cardList($data)
    {
        $data = init_array($data,['page'=>1, 'listRows'=>15, 'status'=>'', 'keywords'=>'']);
        ValidateBankcard::checkValidate($data,['status','keywords']);

        return (new BankcardLogic())->cardList($data);
    }

    /*后台 - 删除银行卡*/
    public function AdminDelCard($data): array
    {
        $data = init_array($data,['id'=>0, 'token'=>' ']);
        ValidateBankcard::checkValidate($data,['id']);

        return (new BankcardLogic())->delCard($data);
    }

    /*后台 - 审核银行卡*/
    public function audit($data): array
    {
        $data = init_array($data,['id'=>0, 'status'=>' ']);
        $validateInitData = ['status'=>true];
        ValidateBankcard::checkValidate($data,['id','status'],true,$validateInitData);

        return (new BankcardLogic())->audit($data);
    }
}